﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WMS.HelperClasses;
using WHMS.HelperClasses;
using WHMS.TypedListClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace WMS
{
	public partial class CodingForm : Form
	{
		public CodingForm()
		{
			InitializeComponent();

			LoadData();
		}

		private void LoadData()
		{
			FormsHelper.LoadComboBox(TransactionsDDL, TransactionFields.Id, TransactionFields.PermitNumber, () => Business.GetUncodedTransactions());
		}

		private void transactionsDDL_SelectedIndexChanged(object sender, EventArgs e)
		{
			bindingSource1.DataSource = Business.GetDepositItems(GetSelectedTransactionId());
		}

		private void Print_Click(object sender, EventArgs e)
		{

		}

		private void CodeDone_Click(object sender, EventArgs e)
		{
			Business.CodeDone(GetSelectedTransactionId());

			LoadData();
		}

		private int GetSelectedTransactionId()
		{
			return (int)((System.Data.DataRowView)(TransactionsDDL.SelectedItem)).Row.ItemArray[0];
		}

	}
}
